package com.easyCode.sqlMapper;

import com.easyCode.sqlMapper.mapInfo.DataBaseMapInfo;
import com.easyCode.sqlMapper.template.RenderHandler;
import com.easyCode.sqlMapper.template.SqlTemplate;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;

/**
 * 通过解析SqlBuilder的构建结果,来创建出对应的文件
 * @author 大忽悠
 * @create 2022/12/1 11:01
 */
@Slf4j
@RequiredArgsConstructor
public class SqlMapper {
    private final SqlTemplate sqlTemplate;

    public void exec(DataBaseMapInfo dataBaseMapInfo){
         sqlTemplate.render(dataBaseMapInfo);
     }

    public void addTemplate(String templateFileName, RenderHandler renderHandler){
         sqlTemplate.addTemplate(templateFileName,renderHandler);
    }

    public void removeTemplate(String templateFileName){
         sqlTemplate.removeTemplate(templateFileName);
    }

    public void addDefaultTemplate(String templateFileName, RenderHandler renderHandler){
        sqlTemplate.addDefaultTemplate(templateFileName,renderHandler);
    }

    public void removeDefaultTemplate(String templateFileName){
        sqlTemplate.removeDefaultTemplate(templateFileName);
    }
}
